<?
	include("../lib/config.php");
	$nik 	= $HTTP_GET_VARS['nik'];
	$no		= $HTTP_GET_VARS['no'];
	
	$sql	= mssql_query("WITH limit AS (SELECT ROW_NUMBER() OVER (ORDER BY seqno) AS No, CONVERT(CHAR(12), tgl_efektif, 103) TglEfektif, CONVERT(CHAR(12), tgl_skd, 103) TglSKD, CONVERT(CHAR(12), tgl_selesai, 103) TglSelesai, * FROM VKarirPTSI WHERE NIK='$nik') SELECT * FROM limit WHERE No='$no'",$conn);
	$row	= mssql_fetch_array($sql);
	
	// untuk hak akses
	$spar = mssql_query("SELECT * FROM VPrivUser WHERE username='".$_SESSION['user_login']."' AND nama_menu='karir_ptsi'",$conn);
	$rpar = mssql_fetch_array($spar);	
	
	include("../header.php");
?>
<form>
<table width="100%">
<tr>
 <td colspan="2" class="line_bottom">&nbsp;&nbsp;<b>Pengangkatan/Mutasi/Promosi/Demosi</b></td>
</tr>
</table>
<table style="position:relative; left:80px;">
<tr>
 <td colspan="2">
  <table >
   <tr>
    <td width="50">NIK</td>
	<td><input type="text" name="nama" readonly=""  value="<?=$row[NIK]?>"/></td>
   </tr>
   <tr>
    <td>Nama</td>
	<td><input type="text" size="50" name="nama" readonly="" value="<?=$row[Nama]?>" /></td>
   </tr>
  </table>
 </td>
</tr>
<tr>
 <td colspan="2"><hr noshade="noshade" size="-2" /></td>
</tr>
<tr>
 <td valign="top">
  <table border="0" width="100%">
   <tr>
    <td width="100">No. Surat</td>
	<td><input maxlength="50" readonly="" type="text" name="no_surat" size="30" value="<?=$row[no_surat]?>" /></td>
   </tr>
   <tr>
    <td width="100">Jenis Surat</td>
	<td>
	<select name="jenis_surat" disabled="disabled">
	 <?
	 	$sJS = mssql_query("SELECT * FROM VJenisSurat WHERE IDCode='".$row[Jenis]."'",$conn);
	 	while($rJS = mssql_fetch_array($sJS)){
		echo"<option value='$rJS[IDCode]'";
			if($rJs[IDCode] == $row[Jenis]){
				echo" selected";
			}
		echo">$rJS[nama]</option>";
		}
		//}
	 ?>
	</select> 
	</td>
   </tr>
   <tr>
    <td width="100">Tanggal Efektif</td>
	<td><input type="text" readonly="" name="tgl_efektif" size="11" value="<?=$row[TglEfektif]?>" /></td>
   </tr>
   <tr>
    <td width="100">Tanggal SKD</td>
	<td><input type="text" readonly="" name="tgl_skd" size="11" value="<?=$row[TglSKD]?>" /></td>
   </tr>
   <tr>
    <td width="100">Tanggal Selesai</td>
	<td><input type="text" readonly="" name="tgl_selesai" value="<?=$row[TglSelesai]?>" size="11" /></td>
   </tr>
   <tr>
    <td colspan="2" valign="top">
	 <fieldset><legend><b>Jabatan Utama</b></legend>
	 <table>
	  <tr>
	   <td>Unit Kerja</td>
	   <td><!--<input type="text" readonly="" name="seksi1" size="35" /> -->
	   <select name="seksi1" style="width:227px;" disabled="disabled">
	   <?
	   	$sek1	= mssql_query("SELECT * FROM MstSO WHERE kode_so='$row[kode_so1]'",$conn);
		$rek1	= mssql_fetch_array($sek1);
		echo"<option value='$rek1[kode_so]'>$rek1[AreaCode] - $rek1[uraian]</option>";
	   ?>
	    <option value="">--Pilih--</option>
	   <?
	   	$sseksi1	= mssql_query("SELECT * FROM MstSO ORDER BY kode_so",$conn);
		while($rseksi1 = mssql_fetch_array($sseksi1)){
			echo"<option value='$rseksi1[kode_so]'>$rseksi1[kode_so] - $rseksi1[uraian]</option>";
		}
	   ?>
	   </select>
	   </td>
	  </tr>
	  <tr>
	   <td>Lokasi</td>
	   <td>
	   <select name="lokasi1" style="width:227px;" disabled="disabled">
	    <?
			$getL1 = mssql_query("SELECT * FROM MstLokasi WHERE kode_lokasi='$row[lokasi1]' ",$conn);
			$rowL1 = mssql_fetch_array($getL1);
			echo"<option value='$rowL1[kode_lokasi]'>$rowL1[propinsi] - $rowL1[distrik]</option>";
		?>
	    <option value="">--pilih--</option>
	   <?
	   		$sqlLokasi = mssql_query("SELECT * FROM MstLokasi WHERE kode_lokasi LIKE 'D%' ORDER BY propinsi,distrik",$conn);
			while($rowLokasi = mssql_fetch_array($sqlLokasi)){
				echo"<option value='$rowLokasi[kode_lokasi]'>$rowLokasi[propinsi] - $rowLokasi[distrik]</option>";
			}
	   ?>
	   </select>
	   </td>
	  </tr>
	  <!--
	  <tr>
	   <td>Kelompok Jabatan</td>
	   <td><input readonly="" type="text" name="kel_jabatan1" size="35"/> </td>
	  </tr>
	  -->
	  <tr>
	   <td>Jabatan</td>
	   <td>
	   <select disabled="disabled" name="jabatan1" style="width:227px;">
	    <?
			$getJ1 = mssql_query("SELECT * FROM MstJabatan WHERE kode='$row[jabatan1]' ",$conn);
			$rowJ1 = mssql_fetch_array($getJ1);
			echo"<option value='$rowJ1[kode]'>$rowJ1[jabatan]</option>";
		?>
	    <option value="">--Pilih--</option>
		<?
			$sJab = mssql_query("SELECT * FROM MstJabatan ORDER BY jabatan ASC",$conn);
			while($rJab = mssql_fetch_array($sJab)){
				echo"<option value='$rJab[kode]'>$rJab[jabatan]</option>";
			}
		?>
	   </select> 
	   </td>
	  </tr>
	  <tr>
	   <td>Fungsional</td>
	   <td>
	   <select disabled="disabled" name="fungsi1" style="width:227px;">
	    <?
			$getF1 = mssql_query("SELECT * FROM MstFungsional WHERE kode='$row[fungsi1]' ",$conn);
			$rowF1 = mssql_fetch_array($getF1);
			echo"<option value='$rowF1[kode]'>$rowF1[nama]</option>";
		?>
	    <option value="">--Pilih--</option>
		<?
			$sFungsi = mssql_query("SELECT * FROM MstFungsional ORDER BY nama ASC",$conn);
			while($rFungsi = mssql_fetch_array($sFungsi)){
				echo"<option value='$rFungsi[kode]'>$rFungsi[nama]</option>";
			}
		?>
	   </select> 
	   </td>
	  </tr>
	  <tr>
	   <td>Golongan</td>
	   <td>
		  <select disabled="disabled" name="golongan">
		   <option value="<?=$row[gol1]?>"><?=$row[gol1]?></option>
		   <option value="">--Pilih--</option>
			<?
				for($r=1;$r<=15;$r++){
					echo"<option value='$r'>$r</option>";
				}
			?>
		  </select> 
	   </td>
	  </tr>
	  <tr>
	   <td>Status Karyawan</td>
	   <td>
	   <select disabled="disabled" name="status_karyawan" style="width:227px;">
	   <?
	   	$sql_stats1 = mssql_query("SELECT * FROM VStatusKaryawan WHERE kode='$row[stat_kar1]'",$conn);
		$row_stats1 = mssql_fetch_array($sql_stats1);
		echo"<option value='$row_stats1[kode]'>$row_stats1[Nama]<option";
	   ?>
	   <option value="">--Pilih--</option>
	   <?
	   		$sql_stat	= mssql_query("SELECT * FROM VStatusKaryawan ORDER BY Nama",$conn);
			while($row_stat = mssql_fetch_array($sql_stat)){
				echo"<option value='$row_stat[kode]'>$row_stat[Nama]</option>";
			}
	   ?>
	   </select> 
	   </td>
	  </tr>
	 </table>
	 </fieldset>
	</td>
   </tr>
  </table>
 </td>
 <td valign="top">
  <table border="0" width="100%">
   <tr>
    <td width="100">&nbsp;</td>
	<td>&nbsp;</td>
   </tr>
   <tr>
    <td width="100" valign="top">Keterangan</td>
	<td valign="top"><textarea cols="55" name="keterangan" readonly="readonly"><?=$row[keterangan]?></textarea></td>
   </tr>
   <tr>
    <td width="100">Kelompok</td>
	<?
		$mss = mssql_query("SELECT * FROM VKlpOperasional WHERE kode='$row[kelompok]'",$conn);
		$rrr = mssql_fetch_array($mss);
	?>
	<td><input type="text" readonly=""  value="<?=$rrr[nama]?>" size="50" name="kelompok"/></td>
   </tr>
   <tr height="26">
    <td width="100">&nbsp;</td>
	<td></td>
   </tr>
   <tr>
    <td colspan="2" height="100" valign="top">
	 <fieldset><legend><b>Jabatan Rangkap</b></legend>
	 <table>
	  <tr>
	   <td>Jabatan</td>
	   <td>
	   <select name="jabatan2" style="width:227px;" disabled="disabled">
	    <?
			$getJ2 = mssql_query("SELECT * FROM MstJabatan WHERE kode='$row[jabatan2]' ",$conn);
			$rowJ2 = mssql_fetch_array($getJ2);
			echo"<option value='$rowJ2[kode]'>$rowJ2[jabatan]</option>";
		?>
	    <option value="">--Pilih--</option>
		<?
			$sJab2 = mssql_query("SELECT * FROM MstJabatan ORDER BY jabatan ASC",$conn);
			while($rJab2 = mssql_fetch_array($sJab2)){
				echo"<option value='$rJab2[kode]'>$rJab2[jabatan]</option>";
			}
		?>
	   </select>
	   </td>
	  </tr>
	  <tr>
	   <td>Fungsional</td>
	   <td>
	   <select name="fungsi2" style="width:227px;" disabled="disabled">
	    <?
			$getF2 = mssql_query("SELECT * FROM MstFungsional WHERE kode='$row[fungsi2]' ",$conn);
			$rowF2 = mssql_fetch_array($getF2);
			echo"<option value='$rowF2[kode]'>$rowF2[nama]</option>";
		?>
	    <option value="">--Pilih--</option>
		<?
			$sFungsi2 = mssql_query("SELECT * FROM MstFungsional ORDER BY nama ASC",$conn);
			while($rFungsi2 = mssql_fetch_array($sFungsi2)){
				echo"<option value='$rFungsi2[kode]'>$rFungsi2[nama]</option>";
			}
		?>
	   </select>
	   </td>
	  </tr>
	 </table>
	 </fieldset>
	</td>
   </tr>
  </table>
 </td>
</tr>
<tr>
 <td colspan="2" align="right">
  <input type="hidden" name="cat" value="karir_ptsi" />
  <input type="button" value="Batal" class="button" onblur="Javascript:history.back();" />
  <?
  	// tambah
	if($rpar[tambah] == 1){
  ?>
  <input type="button" class="button" value="Tambah" onclick="Javascript:location.href='../form/frm_karir_ptsi.php?nik=<?=$row[NIK]?>&amp;nama=<?=$row[Nama]?>'"/> 
  <?
  	}
	
	// edit
	if($rpar[edit] == 1){
  ?>
  <input type="button" value="Edit" class="button" onclick="Javascript:location.href='../form/frm_karir_ptsi.php?op=edit&amp;nik=<?=$row[NIK]?>&amp;no=<?=$row[No]?>'" />
  <?
  	}
  ?>
 </td>
</tr>
</table>
</form>
<br /><br /><br />
</td>
</tr>
<tr>
 <td colspan="2" style="border:none;"><? include("../footer.php"); ?></td>
</tr>
</table>
<script type="text/javascript">

var f = document.forms[0];
MaskInput(f.tgl_efektif,"99/99/9999");
MaskInput(f.tgl_skd,"99/99/9999");
MaskInput(f.tgl_selesai,"99/99/9999");
//MaskInput(f.ipk,"999");
//]]>
</script>
<script type="text/javascript">
// script untuk popup calendar
	var calA = new calendar1(document.forms[0].elements['tgl_efektif']);
	calA.year_scroll = true;
	calA.time_comp = false;	
	var calB = new calendar1(document.forms[0].elements['tgl_skd']);
	calB.year_scroll = true;
	calB.time_comp = false;	
	var calC = new calendar1(document.forms[0].elements['tgl_selesai']);
	calC.year_scroll = true;
	calC.time_comp = false;	

</script>

</body>
</html>
